import request from './request'

/**
 * 获取所有头衔列表
 */
export const getAllTitles = () => {
  return request({
    url: '/title/list',
    method: 'get'
  })
}

/**
 * 根据组织ID获取头衔列表
 */
export const getTitlesByOrgId = (orgId) => {
  return request({
    url: `/title/org/${orgId}`,
    method: 'get'
  })
}

/**
 * 根据ID获取头衔详情
 */
export const getTitleById = (id) => {
  return request({
    url: `/title/${id}`,
    method: 'get'
  })
}

/**
 * 创建头衔
 */
export const createTitle = (data) => {
  return request({
    url: '/title/create',
    method: 'post',
    data
  })
}

/**
 * 更新头衔
 */
export const updateTitle = (data) => {
  return request({
    url: '/title/update',
    method: 'put',
    data
  })
}

/**
 * 删除头衔
 */
export const deleteTitle = (id) => {
  return request({
    url: `/title/delete/${id}`,
    method: 'delete'
  })
}

